package com.heisen.security.configure;

import com.heisen.security.handler.ApiResourceOpenHander;
import com.heisen.security.handler.XmAccessDeniedHandler;
import com.heisen.security.handler.XmAuthExceptionEntryPoint;
import com.heisen.security.interceptor.XmServerProtectInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

public class XmAuthExceptionConfigure {
    @Bean
    @ConditionalOnMissingBean(name = "accessDeniedHandler")
    public XmAccessDeniedHandler accessDeniedHandler() {
        return new XmAccessDeniedHandler();
    }

    @Bean
    @ConditionalOnMissingBean(name = "authenticationEntryPoint")
    public XmAuthExceptionEntryPoint authenticationEntryPoint() {
        return new XmAuthExceptionEntryPoint();
    }


    @Bean
    @ConditionalOnMissingBean(name = "apiResourceOpenHander")
    public ApiResourceOpenHander apiResourceOpenHander() {
        return new ApiResourceOpenHander();
    }



    @Bean
    @ConditionalOnMissingBean(name = "xmServerProtectInterceptor")
    public XmServerProtectInterceptor xmServerProtectInterceptor() {
        return new XmServerProtectInterceptor();
    }


}
